package be.gwi.alfresco.run.model;


/**
 * The run type enum
 * 
 * @author gabriel.willems@gmail.com
 * 
 * @version 1.0
 * @since 1.0
 */
public enum RunType {

    RUNNING("RUNNING"), CYCLING("CYCLING"), SWIMMING("SWIMMING"), ALL("ALL");

    private String name;

    private RunType(String name) {
        this.name = name;
    }

    /**
     * Returns the Run type name.
     * 
     * @return the Run type name.
     */
    public String getName() {
        return this.name;
    }
    
    /**
     * Returns the runType corresponding to the specified runType name,
     * {@code ALL} if no runType corresponds.
     * 
     * @param runType
     *            the runType name.
     * 
     * @return the runType corresponding to the specified runType name,
     *         {@code ALL} if no runType corresponds.
     */
    public static RunType getRunType(String runTypeName) {
        for (RunType runType : values()) {
            if (runType.getName().equals(runTypeName)) {
                return runType;
            }
        }
        return ALL;
    }
}
